package com.lanou.myapplication.movieAdapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.myapplication.entertainmentFragment.HeadLineFragment2;
import com.lanou.myapplication.entity.Entertainment;
import com.lanou.myapplication.entity.Movie;
import com.lanou.myapplication.movieFragment.HeadLineFragment4;

import java.util.List;

/**
 * Created by dllo on 15/10/23.
 */
public class ViewPagerAdapter4 extends FragmentPagerAdapter {
    private List<Movie.T1348648650048Entity> t1348648650048Entities;

    public void addData(List<Movie.T1348648650048Entity> data){
        t1348648650048Entities =data;
      notifyDataSetChanged();
    }


    public ViewPagerAdapter4(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        Movie.T1348648650048Entity l =  t1348648650048Entities.get(position);
        String title =l.getTitle();
        String imgsrc=l.getImgsrc();

        return HeadLineFragment4.getInstance(title, imgsrc);
    }

    @Override
    public int getCount() {
        return t1348648650048Entities != null && t1348648650048Entities.size() > 0
          ? t1348648650048Entities.size() :0;
    }
}
